<?php
class Merchant_Service_Receiving
{	
	//收货类型（1 => 标准，2 =>订单退货；3：指定产品退件）
	public static $orderType = array(
        '1' => 'Standard',
        '2' => 'RTV',	//退件
        '3' => 'RTV',
    );
	
	public function __construct(){
		
	}

	public function add($row){
		$Obj = new Merchant_Model_Receiving();
		return $Obj->add($row);		
	}
	
	public function update($row,$value,$field){
		$Obj = new Merchant_Model_Receiving();
        $row['modified']=date('Y-m-d H:i:s');
		return $Obj->update($row,$value,$field);		
	}
	
	public function delete($value,$field){
		$Obj = new Merchant_Model_Receiving();
		return $Obj->delete($value,$field);		
	}
	
	public function getByValue($value,$field='receiving_id'){
		$Obj = new Merchant_Model_Receiving();
		return $Obj->getByValue($value,$field);	
	}
	
	/**
	 * 根据条件获取指定信息
	 */
	public function getByCond($cond,$type,$order,$count,$offset){
		$Obj = new Merchant_Model_Receiving();
		$rows = $Obj->getByCond($cond,$type,$order,$count,$offset);
		return $rows;		
	}
	
	public function getRMAListByCond($cond,$type,$order,$count,$offset){
		$Obj = new Merchant_Model_Receiving();
		$rows = $Obj->getRMAListByCond($cond,$type,$order,$count,$offset);
		return $rows;		
	}
	
	/**
	 * 获取当天最后一个 receiving_code
	 */
	public function getCurdateLastCode($customer_id,$order_type=1){
		$Obj = new Merchant_Model_Receiving();
		$row = $Obj->getCurdateLastCode($customer_id,$order_type);
		return $row;		
	}
	
	/**
	 * 获取当天最后一个 退货code
	 */
	public function getCurdateLastReturnCode($customer_id){
		$Obj = new Merchant_Model_Receiving();
		$row = $Obj->getCurdateLastReturnCode($customer_id);
		return $row;		
	}
	
}